<!--#include file="Config.asp"-->
<!--#include file="emp_is.asp"-->
<!--#include file="Header.asp"-->

<%
intID=int(Request("id"))
ActionType=request("ActionType")
SaveType=request("SaveType")
set rs=server.createobject("adodb.recordset")

'Add
if ActionType="Add" or ActionType="" then
AName="确定增加"
URL="?SaveType=AddOK"
end if

'Mod
if ActionType="Mod" and intID<>"" then
AName="确定修改"
sql="select * from CMDB_UseForType where id="&Intid
rs.open sql,conn,1,1
name=rs("name")
Info=rs("Info")
ID=int(rs("id"))
rs.close
AID=intID
URL="?SaveType=ModOK&ID="&intID
end if

'SaveAdd
if SaveType="AddOK" and request("name")<>"" then
sql="select * from CMDB_UseForType where id is null"
rs.open sql,conn,1,3
rs.addnew
rs("name")=trim(Request("name"))
rs("info")=trim(Request("name"))
rs.Update
rs.close
end if

'SaveMod
if SaveType="ModOK" and intID<>"" and request("name")<>"" then
sql="select * from CMDB_UseForType where id="&IntID
rs.open sql,conn,1,3
rs("name")=trim(Request("name"))
rs("info")=trim(Request("name"))
rs.Update
rs.close

end if
%>
<!--添加  -->
<table class="table table-condensed table-hover table-striped table-bordered">
<form method="post" action="<%=URL%>" name="form1">
<tr bgcolor='#ddeeff'>
<td>
Name:<input type="text" name="name" value="<%=name%>">
Info:<input type="text" name="Info" value="<%=Info%>">
<input type="submit" name="Submit" value="<%=aname%>">

<A HREF="?ActionType=Add">[<U><FONT COLOR="#FF0000"><B>增加用途</B></FONT></U>]</A>

</td>
</tr>
</form>
</table>
<%
sql="select * from CMDB_UseForType order by id"
rs.open sql,conn,1,1
%>

<table class="table table-condensed table-hover table-striped table-bordered">
<tr  bgcolor='#ddeeff'>
	<TD>ID</TD>
	<TD>Edit</TD>
	<TD>Name</TD>
	<TD>Info</TD>
</TR>
<%
for r=1 to rs.recordcount
%>

<tr <%if r mod 2=0 then%>bgcolor='#f6f6f6'<%end if%> style="cursor:hand">
	<TD><%=int(rs("id"))%></TD>
	<TD><A HREF="?ActionType=Mod&ID=<%=int(rs("id"))%>" title='点击修改<%=trim(rs("name"))%>'>Edit</A></TD>
	<TD><%=trim(rs("name"))%></TD>
	<TD><%=trim(rs("Info"))%></TD>
</TR>
<%
rs.moveNext
next
rs.close
%>
</TABLE>

<!-- #include file="Footer.asp" -->
